﻿using System.ComponentModel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using NPOI.SS.Formula;
using SnakeShop.Admin.Infrastructure;
using SnakeShop.Configuration;
using SnakeShop.IService;
using SnakeShop.Model.ViewModels.UI;
using SnakeShop.Utility.Helper;

namespace SnakeShop.Admin.Controllers.User
{


    [Description("用户")]
    [Route("api/[controller]/[action]")]
    [ApiController]
    [RequiredErrorForAdmin]
    [Authorize(Permissions.Name)]
    public class ShopUserController : ControllerBase
    {

        private readonly ICoreCmsUserServices _coreCmsUserService;
        private readonly IWebHostEnvironment _webHostEnvironment;

        public ShopUserController(ICoreCmsUserServices coreCmsUserService, 
            IWebHostEnvironment webHostEnvironment)
        {
            _coreCmsUserService = coreCmsUserService;
            _webHostEnvironment = webHostEnvironment;
        }


        //POST: Api/ShopUser/GetIndex
        /// <summary>
        /// 首页
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [Description("首页")]
        public async Task<AdminUiCallBack> GetIndex()
        {
            var jm = new AdminUiCallBack() { code= 0 };

            var sexTypes = EnumHelper.EnumToList<GlobalEnumVars.UserSexTypes>();
            var userStatus = EnumHelper.EnumToList<GlobalEnumVars.UserSexTypes>();
            var userAccountType = EnumHelper.EnumToList<GlobalEnumVars.UserAccountTypes>();

            jm.data = new
            {
                sexTypes,
                userStatus,
                userAccountType

            };

            return jm;
        }
    }
}
